using System;
using NUnit.Framework;

namespace SmartPeople.Framework.SecuritySpace.Tests
{
    /// <summary>
    /// Custom Assert using method deligate.
    /// </summary>
    public class MyAssert
    {
        public delegate void MethodWithException();

        public static void ExpectedException(Type type, MethodWithException methodWithException, string message)
        {
            bool exceptionThown = false;
            try
            {
                methodWithException();
            }
            catch (Exception ex)
            {
                Assert.IsInstanceOfType(type, ex, message);
                exceptionThown = true;
            }
            if (!exceptionThown)
                Assert.Fail(message);
        }
    }
}